package day240523.练习;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //练习1统计s在content中出现了几次
        String s = "sb";
        String content = "acusbikmnesbciouinsbeik123dsb88";
        int cont = 0;
        for (int i = 0; i < content.length(); i++) {
            if (content.charAt(i) == 's' && content.charAt(i + 1) == 'b') {
                cont++;

            }

        }
        System.out.println(cont);
        //练习2支持让用户输入手机号码，最终显示的时候隐藏中间4位
        Scanner scanner = new Scanner(System.in);
        String msg = scanner.next();
        String a = null;
        if (msg.length() == 11) {
            a = msg.replace(msg.substring(3,7), "****");
        }
        System.out.println(a);
        //练习3模拟你的网站支持用户发评论，进行敏感词过滤，将敏感词替换成***，敏感词不知一个，是一个词库
        String[] words={"敏感词1","敏感词2","敏感词3"};
        String content1="敏感词1，我敏感词2你敏感词3";
        for (String word:words){
            content1=content1.replaceAll(word,"***");
        }
        System.out.println(content1);

    }
}